package StudyCode.summary.myfile;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class FormatBytesToString {
	public static void main(String[] argv) {
		byte bytes = 2;
		System.out.println("字节" + bytes + "格式化成字符串:");
		System.out.println(formatBytes(bytes));
	}

	private static String formatBytes(byte... bytes) {
		StringBuilder sb = new StringBuilder(bytes.length * 3);
		for (byte byt : bytes) {
			sb.append(String.format("%02X ", byt));
		}
		return sb.toString();
	}
}
